package demo1;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class CallerTask implements Callable<String>
{
    @Override
    public String call()
        throws Exception
    {
        return "hello";
    }
    public static void main(String[] args)
    {
        FutureTask<String> futureTask = new FutureTask<>(new CallerTask());
        new Thread(futureTask).start();

        try
        {
            String str = futureTask.get();
            System.out.println(str);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }

    }
}
